package com.backstage.common.error;

import org.springframework.boot.web.servlet.ErrorPage;
import org.springframework.boot.web.servlet.ErrorPageRegistrar;
import org.springframework.boot.web.servlet.ErrorPageRegistry;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;

/**
 * @Project authority
 * @Package com.backstage.common.error
 * @Data 2017/7/12下午 3:23.
 * @Aurhor 阮雪峰
 */
@Component
public class CommonErrorPageRegistrar implements ErrorPageRegistrar {

    @Override
    public void registerErrorPages(ErrorPageRegistry registry) {
        ErrorPage error404 = new ErrorPage(HttpStatus.NOT_FOUND, "/common/404.html");
        //ErrorPage error500 = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/common/404.html");
        registry.addErrorPages(error404);
    }
}
